#指定要运行的py文件路径
filename =('C:##############.py')
#打开读取文件
f = open(filename,'r')
lines = f.readlines()
print(lines)
#计算最长行的长度
max_len = 0
for line in lines:
    if len(line) > max_len:
        max_len = len(line)
#给每行加上注释行号
num_line = 0
for line in lines:
    num_line += 1
    line = line.rstrip() +'#'+str(num_line)
    print(line)
new_filename = filename[:-3]+'_new1.py'
new_file = open(new_filename,'w')
new_file.writelines(num_lines)